{% extends "AcmeLikipeBlogBundle::Common/layout.html.twig" %}


{% block title %}
 Home Page
{% endblock %}

{% block content %}

{% if blogs|length == 0 %}
<h1>No Blog found!</h1>
{% else %}

{% if app.session.hasFlash('notice') %}
<span style="color: red">{{ app.session.flash('notice') }}</span>
{% endif %}
<h1>List Blogs</h1>

<table border="5">
	<tr>
		<th>STT</th>
		<th>ID</th>
		<th class="list_blogs">TITLE</th>
		<th>CREATED</th>
		<th>MAXIMUM</th>
		<th>ACTION</th>
	</tr>
	{% for key, blog in blogs %}
	<tr>
		<td>{{ key + 1 }}</td>
		<td>{{ blog.id }}</td>
		<td><a href="{{ path('AcmeLikipeBlogBundle_post', {'iId': blog.id}) }}">{{ blog.title }}</a></td>
		<td>{{ blog.created|date('d/m/y') }}</td>
		<td style="text-align: center;">{{ blog.maximum }}</td>
		<td style="text-align: center;">
			<a href="{{ path('AcmeLikipeBlogBundle_blog_delete', {'iId': blog.id}) }}" onclick="if (! confirm('You are sure to delete this Blog?')) return false;">
				<img style="width: 32px; heigth: 32px;" alt="Delete blog with id {{ blog.id }}" src="{{ asset('likipe/img/button_delete.png') }}">
			</a>
			<a href="{{ path('AcmeLikipeBlogBundle_blog_edit', {'iId': blog.id}) }}">
				<img style="width: 32px; heigth: 32px;" alt="Edit blog with id {{ blog.id }}" src="{{ asset('likipe/img/button_edit.png') }}">
			</a>
		</td>
	</tr>
	{% endfor %}
</table>

{% endif %}
<br /><br />
<a style="font-size: 20px; font-family: Brush Script Std;" href="{{ path('AcmeLikipeBlogBundle_blog_add') }}">Create new Blog</a>
<br /><br />
{% endblock %}

{% block javascript %}
 <script type="text/javascript">
<!--
function show_post(id){
	$('#list_post_' + id).slideToggle();
}
//-->
</script>
{% endblock %}


